package com.itheima.thread.api.demo07;

import java.util.concurrent.TimeUnit;

public class ThreadDemo01 {

    public static void main(String[] args) {

        // 创建线程线程对象
        MyThread t1 = new MyThread() ;

        // 启动线程
        t1.start();

        // 主线程休眠
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        // 调用interrupt方法中断t1线程的休眠
        t1.interrupt();   // java.lang.InterruptedException: sleep interrupted抛出异常因为这种中断不是正常性的中断

    }

}
